<?php echo $this->Section->main();?>
<?php echo $this->Html->css(array(HOST.'/news',HOST.'/form',HOST.'/actions'),null,array('inline'=>false));?>
<?php echo $this->Html->script(array(HOST.'/baner',HOST.'/actions',HOST.'/galeria'),$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));?>

<div id="content_header">
	<div class="clear">&nbsp;</div>
</div>
<div class="clear"></div>
<div id="content_repeat">
	<div class="grid_1">
		<?php echo $this->element('languages')?>
	</div>
	<div class="grid_2">
		<p><?php //crumbs ?>&nbsp;</p>
	</div>
	<div class="grid_1">
		<?php echo $this->element('search')?>
	</div>	
	<div class="clear">&nbsp;</div>
</div>
<div class="clear"></div>

<div id="content_repeat">
	<div class="grid_1">
		<?php echo $this->element('menu-left');?>
	</div>
	<div class="grid_2">

				<div class="article-text newsContent">
					<div class="title">
						<h2 class="homepage-news-title corners-left-top corners-right-top"><?php echo $news['News']['name']; ?></h2>
					</div>                    
					<div class="description"> </div>
					<div class="text">
						<?php $thumb = $this->Html->url('/', true).str_replace(' ',"%20",$fileUpload->image($news['NewUpload']['name'],array('autoResize'=>true,'width'=>200,'height'=>200,'imagePathOnly'=>true)));?>
						
						<?php
							$file_path = $fileUpload->image($news['NewUpload']['name'],array('autoResize'=>true,'width'=>800,'height'=>800,'imagePathOnly'=>true)); 
							$file = $this->Html->url('/', true).str_replace(' ',"%20",$file_path);
						?>
						
						<?php if(!empty($file_path)){?>
						<p style="float: left; padding: 10px; ">
							<?php 
								$title = Inflector::slug($news['News']['name'],' ');
								echo $this->Html->link("&nbsp;", $file,array('escape'=>false,'class'=>"highslide", 'title'=>$news['News']['name'], 'style'=>"background: url(".$thumb.") center no-repeat;",'onclick'=>"return hs.expand(this,{captionText: '{$title}'})")); ?>    	
						</p>
						<?php }?>
						
						<?php //echo $fileUpload->image($news['NewUpload']['name'],array('autoResize'=>false,'width'=>300,'height'=>300,'imagePathOnly'=>false,'style'=>'float: left; padding: 10px; margin: 10px;'));?>
					    <p><?php echo $news['News']['content']; ?></p>

			 			<?php 
			 			$gallery_name = Inflector::slug($news['News']['name'],'-');
			 			echo $this->element('gallery',array('plugin' => false,
						'items'=>$this->Gallery->index($gallery_name,array('limit'=>false))
						,'category_id'=>$gallery_name
						,'params_left'=>array('width'=>110,'height'=>90,'border'=>0,'margin'=>3,'padding'=>5)
						));
			 			?>
			
					</div>
				</div> 
				
				<?php if($session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'admin' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'manag' || $session->check('Auth.User.id') && $this->Session->read('Auth.User.group') == 'emplo'){?>
				<div class="actions main_actions">
					<ul>
						<li><?php echo $this->Html->link(__('Aktualnoci', true), array('plugin'=>'calendar','controller'=>'news','action'=>'display'),array('escape'=>false,'class'=>'home')); ?></li>
						<li><?php echo $this->Html->link(__('Dodaj', true), 
							array('plugin'=>'calendar','controller'=>'news','action'=>'add'),
							array('escape'=>false,'style'=>'background-image: url(/img/firma/actions_16_add.png)')); ?></li>					
						<li><?php echo $this->Html->link(__('Edytuj', true), 
							array('plugin'=>'calendar','controller'=>'news','action'=>'edit',$news['News']['id']),
							array('escape'=>false,'style'=>'background-image: url(/img/firma/actions_16_edit.png)')); ?></li>					
						<li><?php echo $this->Html->link(__('Usuń', true), 
							array('plugin'=>'calendar','controller'=>'news','action'=>'delete',$news['News']['id']),
							array('escape'=>false,'style'=>'background-image: url(/img/firma/actions_16_delete.png)'),sprintf(__('Are you sure you want to delete # %s?', true), $news['News']['name'])); ?></li>					
				
					</ul>
				</div>
				<?php }?>
				 		
 		&nbsp;
	</div>
	<div class="grid_1">
		<?php echo $this->element('menu-right');?>
	</div>	
	<div class="clear">&nbsp;</div>
</div>


